<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateKfProductMenus extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    private $table_name = 'product_menus';
    public function up()
    {
        Schema::create($this->table_name, function (Blueprint $table) {
            $table->id();
            $table->string('name', 25)->default('')->comment('菜单名称');
            $table->string('desc', 30)->default('')->comment('菜单描述');
            $table->tinyInteger("status")->default(0)->comment("状态,0:正常,1:停用,2:其他");
            $table->unsignedInteger("createdAt")->default(0)->comment("创建时间");
            $table->unsignedInteger("updatedAt")->default(0)->comment("修改时间");
            $table->tinyInteger('isDeleted')->default(0)->comment("是否删除 0：未删除，1：已删除");
            $table->collation = 'utf8mb4_general_ci';
            $table->index(['name'], 'nameIdx');
        });

        $prefix = config('other.DB_PREFIX','');
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `{$prefix}{$this->table_name}` COMMENT = '门店菜单表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists($this->table_name);
    }
}
